<?php 
class CaptchaHelper{
	public static function setCaptcha($captcha = ''){
		sfContext::getInstance()->getUser()->setAttribute('captcha', md5($captcha));
	}
	public static function isValidate($captcha = '-1'){
		$result =  sfContext::getInstance()->getUser()->getAttribute('captcha')== md5($captcha);
		self::clearCaptcha();
		return $result;
	}
	public static function clearCaptcha(){
		sfContext::getInstance()->getUser()->setAttribute('captcha', null);
	}
}